<?php echo $this->Html->css('matricula');?>

<div class="matriculas view">
<h2><?php echo __('Matrícula'); ?></h2>
	<dl>
		<dt><?php echo __('Número'); ?></dt>
		<dd>
			<?php echo h($matricula['Matricula']['numero']); ?>
			&nbsp;
		</dd>
                <dt><?php echo __('Aluno'); ?></dt>
		<dd>
			<?php echo $this->Html->link($matricula['Aluno']['Pessoa']['nome'], array('controller' => 'alunos', 'action' => 'view', $matricula['Aluno']['id'])); ?>
			&nbsp;
		</dd>
		<dt><?php echo __('Data'); ?></dt>
		<dd>
			<?php echo h($this->Formatter->formatarData($matricula['Matricula']['data'])); ?>
			&nbsp;
		</dd>
                <dt><?php echo __('Valor Matrícula'); ?></dt>
		<dd>
			<?php echo h($this->Formatter->formatarDecimal($matricula['Matricula']['valor'])); ?>
			&nbsp;
		</dd>
	</dl>
        <br /><br />
        <div class="related">
            <h3><?php echo __('Detalhamento'); ?></h3>
            <table cellpadding = "0" cellspacing = "0">
                <tr>
                    <th><?php echo __('Turma'); ?></th>
                    <th><?php echo __('Disciplina'); ?></th>
                    <th><?php echo __('Valor'); ?></th>
                </tr>
                <?php foreach ($matricula['TurmaMatricula'] as $turmaMatricula): ?>
                    <?php foreach ($turmaMatricula['DisciplinaTurmaMatricula'] as $disciplinaTurmaMatricula): ?>
                        <tr>
                            <td><?php echo $turmaMatricula['Turma']['codigo']; ?></td>
                            <td><?php echo $disciplinaTurmaMatricula['Disciplina']['codigo'] . ' - ' . $disciplinaTurmaMatricula['Disciplina']['nome']; ?></td>
                            <td><?php echo $this->Formatter->formatarDecimal($disciplinaTurmaMatricula['valor']); ?></td>
                        </tr>
                    <?php endforeach; ?>
                <?php endforeach; ?>
            </table>
            <table>
                <tr>
                    <td id="tdLbValorTotal">Valor Total</td>
                    <td id="tdValorTotal">
                        <?php echo $this->Formatter->formatarDecimal($valorTotal);?>
                    </td>
                </tr>
            </table>
            <table>
                <tr>
                    <td id="tdLbValorTotal">Total Geral</td>
                    <td id="tdValorTotal">
                        <?php echo $this->Formatter->formatarDecimal($totalGeral);?>
                    </td>
                </tr>
            </table>
        </div>
        <br /><br />
        <div class="related">
            <h3><?php echo __('Forma de Pagamento'); ?></h3>
            <table cellpadding = "0" cellspacing = "0">
                <tr>
                    <th><?php echo __('Tipo'); ?></th>
                    <th><?php echo __('Valor'); ?></th>
                    <th><?php echo __('Parcelas'); ?></th>
                    <th><?php echo __('Valor Parcela'); ?></th>
                </tr>
                <?php foreach ($matricula['FormaPagamentoMatricula'] as $formaPagamentoMatricula): ?>
                    <tr>
                        <td><?php echo $formaPagamentoMatricula['FormaPagamento']['descricao']; ?></td>
                        <td><?php echo $this->Formatter->formatarDecimal($formaPagamentoMatricula['valor']); ?></td>
                        <td><?php echo $formaPagamentoMatricula['parcelas']; ?></td>
                        <td><?php echo $this->Formatter->formatarDecimal($formaPagamentoMatricula['valor_parcela']); ?></td>
                    </tr>
                <?php endforeach; ?>
            </table>
            <table>
                <tr>
                    <td id="tdLbValorTotal">Valor Total</td>
                    <td id="tdValorTotal">
                        <?php echo $this->Formatter->formatarDecimal($valorTotalPagto);?>
                    </td>
                </tr>
            </table>
        </div>
</div>
<div class="actions">
	<h3><?php echo __('Ações'); ?></h3>
	<ul>
		<li><?php echo $this->Html->link(__('Editar Matricula'), array('action' => 'edit', $matricula['Matricula']['id'])); ?> </li>
		<li><?php echo $this->Form->postLink(__('Excluir Matricula'), array('action' => 'delete', $matricula['Matricula']['id']), array(), __('Confirma exclusão da matrícula %s?', $matricula['Matricula']['numero'])); ?> </li>
		<li><?php echo $this->Html->link(__('Listar Matriculas'), array('action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('Nova Matricula'), array('action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('Listar Turmas'), array('controller' => 'turmas', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('Nova Turma'), array('controller' => 'turmas', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('Listar Alunos'), array('controller' => 'alunos', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('Novo Aluno'), array('controller' => 'alunos', 'action' => 'add')); ?> </li>
	</ul>
</div>
